﻿using System.IO;
using NUnit.Framework;
using Sample.Persistence;

namespace SampleTests
{
    [TestFixture]
    public class When_generating_schema
    {
        [Test]
        public void Can_generate_schema()
        {
            NHibernateHelper.GenerateSchema(true);
        }

        [Test]
        public void Can_generate_hbm_files()
        {
            var dir = new DirectoryInfo(@".\mappings");
            
            if (dir.Exists)
            {
                dir.Delete(true);
                dir.Refresh();
            }

            NHibernateHelper.WriteModels(dir);
            Assert.Greater(dir.GetFiles().Length, 0);
            //if (dir.Exists) { dir.Delete(true); }
        }
    }
}
